#pragma GCC optimize(2)
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <map>
#include <vector>

using namespace std;
using LL = long long;
const int N = 110;

int n;
int d[N];
int res[N];

void solve(){
    cin >> n;
    for(int i = 1; i <= n; i ++) cin >> d[i];

    
    for(int i = 1; i <= n; i ++){
        if(res[i - 1] - d[i] >= 0 && res[i - 1] + d[i] >= 0 && ((res[i - 1] - d[i]) != (res[i - 1] + d[i]))){
            cout << "-1" << '\n';
            return;
        }
        res[i] = res[i - 1] + d[i];
    }

    for(int i = 1; i <= n; i ++) cout << res[i] << " ";
    cout << '\n';
}

int main(){
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int T;
    cin >> T;
    while(T--){
        solve();
    }


    return 0;
}